<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>KolmogorovSmirnovTest (Apache Commons Math 3.6.1 API)</title>
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
    if (location.href.indexOf('is-external=true') == -1) {
        parent.document.title="KolmogorovSmirnovTest (Apache Commons Math 3.6.1 API)";
    }
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!--   -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/KolmogorovSmirnovTest.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><em><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script></em></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../org/apache/commons/math3/stat/inference/GTest.html" title="class in org.apache.commons.math3.stat.inference"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../../org/apache/commons/math3/stat/inference/MannWhitneyUTest.html" title="class in org.apache.commons.math3.stat.inference"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html" target="_top">Frames</a></li>
<li><a href="KolmogorovSmirnovTest.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_top");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field_summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field_detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!--   -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.commons.math3.stat.inference</div>
<h2 title="Class KolmogorovSmirnovTest" class="title">Class KolmogorovSmirnovTest</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li>org.apache.commons.math3.stat.inference.KolmogorovSmirnovTest</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="strong">KolmogorovSmirnovTest</span>
extends <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre>
<div class="block">Implementation of the <a href="http://en.wikipedia.org/wiki/Kolmogorov-Smirnov_test">
 Kolmogorov-Smirnov (K-S) test</a> for equality of continuous distributions.
 <p>
 The K-S test uses a statistic based on the maximum deviation of the empirical distribution of
 sample data points from the distribution expected under the null hypothesis. For one-sample tests
 evaluating the null hypothesis that a set of sample data points follow a given distribution, the
 test statistic is \(D_n=\sup_x |F_n(x)-F(x)|\), where \(F\) is the expected distribution and
 \(F_n\) is the empirical distribution of the \(n\) sample data points. The distribution of
 \(D_n\) is estimated using a method based on [1] with certain quick decisions for extreme values
 given in [2].
 </p>
 <p>
 Two-sample tests are also supported, evaluating the null hypothesis that the two samples
 <code>x</code> and <code>y</code> come from the same underlying distribution. In this case, the test
 statistic is \(D_{n,m}=\sup_t | F_n(t)-F_m(t)|\) where \(n\) is the length of <code>x</code>, \(m\) is
 the length of <code>y</code>, \(F_n\) is the empirical distribution that puts mass \(1/n\) at each of
 the values in <code>x</code> and \(F_m\) is the empirical distribution of the <code>y</code> values. The
 default 2-sample test method, <a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#kolmogorovSmirnovTest(double[],%20double[])"><code>kolmogorovSmirnovTest(double[], double[])</code></a> works as
 follows:
 <ul>
 <li>For small samples (where the product of the sample sizes is less than
 <a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#LARGE_SAMPLE_PRODUCT">10000</a>), the method presented in [4] is used to compute the
 exact p-value for the 2-sample test.</li>
 <li>When the product of the sample sizes exceeds <a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#LARGE_SAMPLE_PRODUCT">10000</a>, the asymptotic
 distribution of \(D_{n,m}\) is used. See <a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#approximateP(double,%20int,%20int)"><code>approximateP(double, int, int)</code></a> for details on
 the approximation.</li>
 </ul></p><p>
 If the product of the sample sizes is less than <a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#LARGE_SAMPLE_PRODUCT">10000</a> and the sample
 data contains ties, random jitter is added to the sample data to break ties before applying
 the algorithm above. Alternatively, the <a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#bootstrap(double[],%20double[],%20int,%20boolean)"><code>bootstrap(double[], double[], int, boolean)</code></a>
 method, modeled after <a href="http://sekhon.berkeley.edu/matching/ks.boot.html">ks.boot</a>
 in the R Matching package [3], can be used if ties are known to be present in the data.
 </p>
 <p>
 In the two-sample case, \(D_{n,m}\) has a discrete distribution. This makes the p-value
 associated with the null hypothesis \(H_0 : D_{n,m} \ge d \) differ from \(H_0 : D_{n,m} > d \)
 by the mass of the observed value \(d\). To distinguish these, the two-sample tests use a boolean
 <code>strict</code> parameter. This parameter is ignored for large samples.
 </p>
 <p>
 The methods used by the 2-sample default implementation are also exposed directly:
 <ul>
 <li><a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#exactP(double,%20int,%20int,%20boolean)"><code>exactP(double, int, int, boolean)</code></a> computes exact 2-sample p-values</li>
 <li><a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#approximateP(double,%20int,%20int)"><code>approximateP(double, int, int)</code></a> uses the asymptotic distribution The <code>boolean</code>
 arguments in the first two methods allow the probability used to estimate the p-value to be
 expressed using strict or non-strict inequality. See
 <a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#kolmogorovSmirnovTest(double[],%20double[],%20boolean)"><code>kolmogorovSmirnovTest(double[], double[], boolean)</code></a>.</li>
 </ul>
 </p>
 <p>
 References:
 <ul>
 <li>[1] <a href="http://www.jstatsoft.org/v08/i18/"> Evaluating Kolmogorov's Distribution</a> by
 George Marsaglia, Wai Wan Tsang, and Jingbo Wang</li>
 <li>[2] <a href="http://www.jstatsoft.org/v39/i11/"> Computing the Two-Sided Kolmogorov-Smirnov
 Distribution</a> by Richard Simard and Pierre L'Ecuyer</li>
 <li>[3] Jasjeet S. Sekhon. 2011. <a href="http://www.jstatsoft.org/article/view/v042i07">
 Multivariate and Propensity Score Matching Software with Automated Balance Optimization:
 The Matching package for R</a> Journal of Statistical Software, 42(7): 1-52.</li>
 <li>[4] Wilcox, Rand. 2012. Introduction to Robust Estimation and Hypothesis Testing,
 Chapter 5, 3rd Ed. Academic Press.</li>
 </ul>
 <br/>
 Note that [1] contains an error in computing h, refer to <a
 href="https://issues.apache.org/jira/browse/MATH-437">MATH-437</a> for details.
 </p></div>
<dl><dt><span class="strong">Since:</span></dt>
  <dd>3.3</dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_summary">
<!--   -->
</a>
<h3>Field Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected static double</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#KS_SUM_CAUCHY_CRITERION">KS_SUM_CAUCHY_CRITERION</a></strong></code>
<div class="block">Convergence criterion for <a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#ksSum(double,%20double,%20int)"><code>ksSum(double, double, int)</code></a></div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected static int</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#LARGE_SAMPLE_PRODUCT">LARGE_SAMPLE_PRODUCT</a></strong></code>
<div class="block">When product of sample sizes exceeds this value, 2-sample K-S test uses asymptotic
 distribution to compute the p-value.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected static int</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#MAXIMUM_PARTIAL_SUM_COUNT">MAXIMUM_PARTIAL_SUM_COUNT</a></strong></code>
<div class="block">Bound on the number of partial sums in <a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#ksSum(double,%20double,%20int)"><code>ksSum(double, double, int)</code></a></div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected static int</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#MONTE_CARLO_ITERATIONS">MONTE_CARLO_ITERATIONS</a></strong></code>
<div class="block"><strong>Deprecated.</strong>&nbsp;</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected static double</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#PG_SUM_RELATIVE_ERROR">PG_SUM_RELATIVE_ERROR</a></strong></code>
<div class="block">Convergence criterion for the sums in #pelzGood(double, double, int)}</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected static int</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#SMALL_SAMPLE_PRODUCT">SMALL_SAMPLE_PRODUCT</a></strong></code>
<div class="block"><strong>Deprecated.</strong>&nbsp;</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!--   -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#KolmogorovSmirnovTest()">KolmogorovSmirnovTest</a></strong>()</code>
<div class="block">Construct a KolmogorovSmirnovTest instance with a default random data generator.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#KolmogorovSmirnovTest(org.apache.commons.math3.random.RandomGenerator)">KolmogorovSmirnovTest</a></strong>(<a href="../../../../../../org/apache/commons/math3/random/RandomGenerator.html" title="interface in org.apache.commons.math3.random">RandomGenerator</a>&nbsp;rng)</code>
<div class="block"><strong>Deprecated.</strong>&nbsp;</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!--   -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#approximateP(double,%20int,%20int)">approximateP</a></strong>(double&nbsp;d,
            int&nbsp;n,
            int&nbsp;m)</code>
<div class="block">Uses the Kolmogorov-Smirnov distribution to approximate \(P(D_{n,m} > d)\) where \(D_{n,m}\)
 is the 2-sample Kolmogorov-Smirnov statistic.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#bootstrap(double[],%20double[],%20int)">bootstrap</a></strong>(double[]&nbsp;x,
         double[]&nbsp;y,
         int&nbsp;iterations)</code>
<div class="block">Computes <code>bootstrap(x, y, iterations, true)</code>.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#bootstrap(double[],%20double[],%20int,%20boolean)">bootstrap</a></strong>(double[]&nbsp;x,
         double[]&nbsp;y,
         int&nbsp;iterations,
         boolean&nbsp;strict)</code>
<div class="block">Estimates the <i>p-value</i> of a two-sample
 <a href="http://en.wikipedia.org/wiki/Kolmogorov-Smirnov_test"> Kolmogorov-Smirnov test</a>
 evaluating the null hypothesis that <code>x</code> and <code>y</code> are samples drawn from the same
 probability distribution.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#cdf(double,%20int)">cdf</a></strong>(double&nbsp;d,
   int&nbsp;n)</code>
<div class="block">Calculates \(P(D_n < d)\) using the method described in [1] with quick decisions for extreme
 values given in [2] (see above).</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#cdf(double,%20int,%20boolean)">cdf</a></strong>(double&nbsp;d,
   int&nbsp;n,
   boolean&nbsp;exact)</code>
<div class="block">Calculates <code>P(D_n &lt; d)</code> using method described in [1] with quick decisions for extreme
 values given in [2] (see above).</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#cdfExact(double,%20int)">cdfExact</a></strong>(double&nbsp;d,
        int&nbsp;n)</code>
<div class="block">Calculates <code>P(D_n &lt; d)</code>.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#exactP(double,%20int,%20int,%20boolean)">exactP</a></strong>(double&nbsp;d,
      int&nbsp;n,
      int&nbsp;m,
      boolean&nbsp;strict)</code>
<div class="block">Computes \(P(D_{n,m} > d)\) if <code>strict</code> is <code>true</code>; otherwise \(P(D_{n,m} \ge
 d)\), where \(D_{n,m}\) is the 2-sample Kolmogorov-Smirnov statistic.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#kolmogorovSmirnovStatistic(double[],%20double[])">kolmogorovSmirnovStatistic</a></strong>(double[]&nbsp;x,
                          double[]&nbsp;y)</code>
<div class="block">Computes the two-sample Kolmogorov-Smirnov test statistic, \(D_{n,m}=\sup_x |F_n(x)-F_m(x)|\)
 where \(n\) is the length of <code>x</code>, \(m\) is the length of <code>y</code>, \(F_n\) is the
 empirical distribution that puts mass \(1/n\) at each of the values in <code>x</code> and \(F_m\)
 is the empirical distribution of the <code>y</code> values.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#kolmogorovSmirnovStatistic(org.apache.commons.math3.distribution.RealDistribution,%20double[])">kolmogorovSmirnovStatistic</a></strong>(<a href="../../../../../../org/apache/commons/math3/distribution/RealDistribution.html" title="interface in org.apache.commons.math3.distribution">RealDistribution</a>&nbsp;distribution,
                          double[]&nbsp;data)</code>
<div class="block">Computes the one-sample Kolmogorov-Smirnov test statistic, \(D_n=\sup_x |F_n(x)-F(x)|\) where
 \(F\) is the distribution (cdf) function associated with <code>distribution</code>, \(n\) is the
 length of <code>data</code> and \(F_n\) is the empirical distribution that puts mass \(1/n\) at
 each of the values in <code>data</code>.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#kolmogorovSmirnovTest(double[],%20double[])">kolmogorovSmirnovTest</a></strong>(double[]&nbsp;x,
                     double[]&nbsp;y)</code>
<div class="block">Computes the <i>p-value</i>, or <i>observed significance level</i>, of a two-sample <a
 href="http://en.wikipedia.org/wiki/Kolmogorov-Smirnov_test"> Kolmogorov-Smirnov test</a>
 evaluating the null hypothesis that <code>x</code> and <code>y</code> are samples drawn from the same
 probability distribution.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#kolmogorovSmirnovTest(double[],%20double[],%20boolean)">kolmogorovSmirnovTest</a></strong>(double[]&nbsp;x,
                     double[]&nbsp;y,
                     boolean&nbsp;strict)</code>
<div class="block">Computes the <i>p-value</i>, or <i>observed significance level</i>, of a two-sample <a
 href="http://en.wikipedia.org/wiki/Kolmogorov-Smirnov_test"> Kolmogorov-Smirnov test</a>
 evaluating the null hypothesis that <code>x</code> and <code>y</code> are samples drawn from the same
 probability distribution.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#kolmogorovSmirnovTest(org.apache.commons.math3.distribution.RealDistribution,%20double[])">kolmogorovSmirnovTest</a></strong>(<a href="../../../../../../org/apache/commons/math3/distribution/RealDistribution.html" title="interface in org.apache.commons.math3.distribution">RealDistribution</a>&nbsp;distribution,
                     double[]&nbsp;data)</code>
<div class="block">Computes the <i>p-value</i>, or <i>observed significance level</i>, of a one-sample <a
 href="http://en.wikipedia.org/wiki/Kolmogorov-Smirnov_test"> Kolmogorov-Smirnov test</a>
 evaluating the null hypothesis that <code>data</code> conforms to <code>distribution</code>.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#kolmogorovSmirnovTest(org.apache.commons.math3.distribution.RealDistribution,%20double[],%20boolean)">kolmogorovSmirnovTest</a></strong>(<a href="../../../../../../org/apache/commons/math3/distribution/RealDistribution.html" title="interface in org.apache.commons.math3.distribution">RealDistribution</a>&nbsp;distribution,
                     double[]&nbsp;data,
                     boolean&nbsp;exact)</code>
<div class="block">Computes the <i>p-value</i>, or <i>observed significance level</i>, of a one-sample <a
 href="http://en.wikipedia.org/wiki/Kolmogorov-Smirnov_test"> Kolmogorov-Smirnov test</a>
 evaluating the null hypothesis that <code>data</code> conforms to <code>distribution</code>.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#kolmogorovSmirnovTest(org.apache.commons.math3.distribution.RealDistribution,%20double[],%20double)">kolmogorovSmirnovTest</a></strong>(<a href="../../../../../../org/apache/commons/math3/distribution/RealDistribution.html" title="interface in org.apache.commons.math3.distribution">RealDistribution</a>&nbsp;distribution,
                     double[]&nbsp;data,
                     double&nbsp;alpha)</code>
<div class="block">Performs a <a href="http://en.wikipedia.org/wiki/Kolmogorov-Smirnov_test"> Kolmogorov-Smirnov
 test</a> evaluating the null hypothesis that <code>data</code> conforms to <code>distribution</code>.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#ksSum(double,%20double,%20int)">ksSum</a></strong>(double&nbsp;t,
     double&nbsp;tolerance,
     int&nbsp;maxIterations)</code>
<div class="block">Computes \( 1 + 2 \sum_{i=1}^\infty (-1)^i e^{-2 i^2 t^2} \) stopping when successive partial
 sums are within <code>tolerance</code> of one another, or when <code>maxIterations</code> partial sums
 have been computed.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#monteCarloP(double,%20int,%20int,%20boolean,%20int)">monteCarloP</a></strong>(double&nbsp;d,
           int&nbsp;n,
           int&nbsp;m,
           boolean&nbsp;strict,
           int&nbsp;iterations)</code>
<div class="block">Uses Monte Carlo simulation to approximate \(P(D_{n,m} > d)\) where \(D_{n,m}\) is the
 2-sample Kolmogorov-Smirnov statistic.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#pelzGood(double,%20int)">pelzGood</a></strong>(double&nbsp;d,
        int&nbsp;n)</code>
<div class="block">Computes the Pelz-Good approximation for \(P(D_n < d)\) as described in [2] in the class javadoc.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!--   -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait(long,%20int)" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_detail">
<!--   -->
</a>
<h3>Field Detail</h3>
<a name="MAXIMUM_PARTIAL_SUM_COUNT">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>MAXIMUM_PARTIAL_SUM_COUNT</h4>
<pre>protected static final&nbsp;int MAXIMUM_PARTIAL_SUM_COUNT</pre>
<div class="block">Bound on the number of partial sums in <a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#ksSum(double,%20double,%20int)"><code>ksSum(double, double, int)</code></a></div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../../constant-values.html#org.apache.commons.math3.stat.inference.KolmogorovSmirnovTest.MAXIMUM_PARTIAL_SUM_COUNT">Constant Field Values</a></dd></dl>
</li>
</ul>
<a name="KS_SUM_CAUCHY_CRITERION">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>KS_SUM_CAUCHY_CRITERION</h4>
<pre>protected static final&nbsp;double KS_SUM_CAUCHY_CRITERION</pre>
<div class="block">Convergence criterion for <a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#ksSum(double,%20double,%20int)"><code>ksSum(double, double, int)</code></a></div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../../constant-values.html#org.apache.commons.math3.stat.inference.KolmogorovSmirnovTest.KS_SUM_CAUCHY_CRITERION">Constant Field Values</a></dd></dl>
</li>
</ul>
<a name="PG_SUM_RELATIVE_ERROR">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>PG_SUM_RELATIVE_ERROR</h4>
<pre>protected static final&nbsp;double PG_SUM_RELATIVE_ERROR</pre>
<div class="block">Convergence criterion for the sums in #pelzGood(double, double, int)}</div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../../constant-values.html#org.apache.commons.math3.stat.inference.KolmogorovSmirnovTest.PG_SUM_RELATIVE_ERROR">Constant Field Values</a></dd></dl>
</li>
</ul>
<a name="SMALL_SAMPLE_PRODUCT">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SMALL_SAMPLE_PRODUCT</h4>
<pre><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a>
protected static final&nbsp;int SMALL_SAMPLE_PRODUCT</pre>
<div class="block"><span class="strong">Deprecated.</span>&nbsp;</div>
<div class="block">No longer used.</div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../../constant-values.html#org.apache.commons.math3.stat.inference.KolmogorovSmirnovTest.SMALL_SAMPLE_PRODUCT">Constant Field Values</a></dd></dl>
</li>
</ul>
<a name="LARGE_SAMPLE_PRODUCT">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>LARGE_SAMPLE_PRODUCT</h4>
<pre>protected static final&nbsp;int LARGE_SAMPLE_PRODUCT</pre>
<div class="block">When product of sample sizes exceeds this value, 2-sample K-S test uses asymptotic
 distribution to compute the p-value.</div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../../constant-values.html#org.apache.commons.math3.stat.inference.KolmogorovSmirnovTest.LARGE_SAMPLE_PRODUCT">Constant Field Values</a></dd></dl>
</li>
</ul>
<a name="MONTE_CARLO_ITERATIONS">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>MONTE_CARLO_ITERATIONS</h4>
<pre><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a>
protected static final&nbsp;int MONTE_CARLO_ITERATIONS</pre>
<div class="block"><span class="strong">Deprecated.</span>&nbsp;</div>
<div class="block">Default number of iterations used by <a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#monteCarloP(double,%20int,%20int,%20boolean,%20int)"><code>monteCarloP(double, int, int, boolean, int)</code></a>.
  Deprecated as of version 3.6, as this method is no longer needed.</div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../../constant-values.html#org.apache.commons.math3.stat.inference.KolmogorovSmirnovTest.MONTE_CARLO_ITERATIONS">Constant Field Values</a></dd></dl>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!--   -->
</a>
<h3>Constructor Detail</h3>
<a name="KolmogorovSmirnovTest()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>KolmogorovSmirnovTest</h4>
<pre>public&nbsp;KolmogorovSmirnovTest()</pre>
<div class="block">Construct a KolmogorovSmirnovTest instance with a default random data generator.</div>
</li>
</ul>
<a name="KolmogorovSmirnovTest(org.apache.commons.math3.random.RandomGenerator)">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>KolmogorovSmirnovTest</h4>
<pre><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a>
public&nbsp;KolmogorovSmirnovTest(<a href="../../../../../../org/apache/commons/math3/random/RandomGenerator.html" title="interface in org.apache.commons.math3.random">RandomGenerator</a>&nbsp;rng)</pre>
<div class="block"><span class="strong">Deprecated.</span>&nbsp;</div>
<div class="block">Construct a KolmogorovSmirnovTest with the provided random data generator.
 The #monteCarloP(double, int, int, boolean, int) that uses the generator supplied to this
 constructor is deprecated as of version 3.6.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>rng</code> - random data generator used by <a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#monteCarloP(double,%20int,%20int,%20boolean,%20int)"><code>monteCarloP(double, int, int, boolean, int)</code></a></dd></dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!--   -->
</a>
<h3>Method Detail</h3>
<a name="kolmogorovSmirnovTest(org.apache.commons.math3.distribution.RealDistribution, double[], boolean)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>kolmogorovSmirnovTest</h4>
<pre>public&nbsp;double&nbsp;kolmogorovSmirnovTest(<a href="../../../../../../org/apache/commons/math3/distribution/RealDistribution.html" title="interface in org.apache.commons.math3.distribution">RealDistribution</a>&nbsp;distribution,
                           double[]&nbsp;data,
                           boolean&nbsp;exact)</pre>
<div class="block">Computes the <i>p-value</i>, or <i>observed significance level</i>, of a one-sample <a
 href="http://en.wikipedia.org/wiki/Kolmogorov-Smirnov_test"> Kolmogorov-Smirnov test</a>
 evaluating the null hypothesis that <code>data</code> conforms to <code>distribution</code>. If
 <code>exact</code> is true, the distribution used to compute the p-value is computed using
 extended precision. See <a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#cdfExact(double,%20int)"><code>cdfExact(double, int)</code></a>.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>distribution</code> - reference distribution</dd><dd><code>data</code> - sample being being evaluated</dd><dd><code>exact</code> - whether or not to force exact computation of the p-value</dd>
<dt><span class="strong">Returns:</span></dt><dd>the p-value associated with the null hypothesis that <code>data</code> is a sample from
         <code>distribution</code></dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/InsufficientDataException.html" title="class in org.apache.commons.math3.exception">InsufficientDataException</a></code> - if <code>data</code> does not have length at least 2</dd>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</a></code> - if <code>data</code> is null</dd></dl>
</li>
</ul>
<a name="kolmogorovSmirnovStatistic(org.apache.commons.math3.distribution.RealDistribution, double[])">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>kolmogorovSmirnovStatistic</h4>
<pre>public&nbsp;double&nbsp;kolmogorovSmirnovStatistic(<a href="../../../../../../org/apache/commons/math3/distribution/RealDistribution.html" title="interface in org.apache.commons.math3.distribution">RealDistribution</a>&nbsp;distribution,
                                double[]&nbsp;data)</pre>
<div class="block">Computes the one-sample Kolmogorov-Smirnov test statistic, \(D_n=\sup_x |F_n(x)-F(x)|\) where
 \(F\) is the distribution (cdf) function associated with <code>distribution</code>, \(n\) is the
 length of <code>data</code> and \(F_n\) is the empirical distribution that puts mass \(1/n\) at
 each of the values in <code>data</code>.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>distribution</code> - reference distribution</dd><dd><code>data</code> - sample being evaluated</dd>
<dt><span class="strong">Returns:</span></dt><dd>Kolmogorov-Smirnov statistic \(D_n\)</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/InsufficientDataException.html" title="class in org.apache.commons.math3.exception">InsufficientDataException</a></code> - if <code>data</code> does not have length at least 2</dd>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</a></code> - if <code>data</code> is null</dd></dl>
</li>
</ul>
<a name="kolmogorovSmirnovTest(double[], double[], boolean)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>kolmogorovSmirnovTest</h4>
<pre>public&nbsp;double&nbsp;kolmogorovSmirnovTest(double[]&nbsp;x,
                           double[]&nbsp;y,
                           boolean&nbsp;strict)</pre>
<div class="block">Computes the <i>p-value</i>, or <i>observed significance level</i>, of a two-sample <a
 href="http://en.wikipedia.org/wiki/Kolmogorov-Smirnov_test"> Kolmogorov-Smirnov test</a>
 evaluating the null hypothesis that <code>x</code> and <code>y</code> are samples drawn from the same
 probability distribution. Specifically, what is returned is an estimate of the probability
 that the <a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#kolmogorovSmirnovStatistic(double[],%20double[])"><code>kolmogorovSmirnovStatistic(double[], double[])</code></a> associated with a randomly
 selected partition of the combined sample into subsamples of sizes <code>x.length</code> and
 <code>y.length</code> will strictly exceed (if <code>strict</code> is <code>true</code>) or be at least as
 large as <code>strict = false</code>) as <code>kolmogorovSmirnovStatistic(x, y)</code>.
 <ul>
 <li>For small samples (where the product of the sample sizes is less than
 <a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#LARGE_SAMPLE_PRODUCT">10000</a>), the exact p-value is computed using the method presented
 in [4], implemented in <a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#exactP(double,%20int,%20int,%20boolean)"><code>exactP(double, int, int, boolean)</code></a>. </li>
 <li>When the product of the sample sizes exceeds <a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#LARGE_SAMPLE_PRODUCT">10000</a>, the
 asymptotic distribution of \(D_{n,m}\) is used. See <a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#approximateP(double,%20int,%20int)"><code>approximateP(double, int, int)</code></a>
 for details on the approximation.</li>
 </ul><p>
 If <code>x.length * y.length</code> < <a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#LARGE_SAMPLE_PRODUCT">10000</a> and the combined set of values in
 <code>x</code> and <code>y</code> contains ties, random jitter is added to <code>x</code> and <code>y</code> to
 break ties before computing \(D_{n,m}\) and the p-value. The jitter is uniformly distributed
 on (-minDelta / 2, minDelta / 2) where minDelta is the smallest pairwise difference between
 values in the combined sample.</p>
 <p>
 If ties are known to be present in the data, <a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#bootstrap(double[],%20double[],%20int,%20boolean)"><code>bootstrap(double[], double[], int, boolean)</code></a>
 may be used as an alternative method for estimating the p-value.</p></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>x</code> - first sample dataset</dd><dd><code>y</code> - second sample dataset</dd><dd><code>strict</code> - whether or not the probability to compute is expressed as a strict inequality
        (ignored for large samples)</dd>
<dt><span class="strong">Returns:</span></dt><dd>p-value associated with the null hypothesis that <code>x</code> and <code>y</code> represent
         samples from the same distribution</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/InsufficientDataException.html" title="class in org.apache.commons.math3.exception">InsufficientDataException</a></code> - if either <code>x</code> or <code>y</code> does not have length at
         least 2</dd>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</a></code> - if either <code>x</code> or <code>y</code> is null</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#bootstrap(double[],%20double[],%20int,%20boolean)"><code>bootstrap(double[], double[], int, boolean)</code></a></dd></dl>
</li>
</ul>
<a name="kolmogorovSmirnovTest(double[], double[])">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>kolmogorovSmirnovTest</h4>
<pre>public&nbsp;double&nbsp;kolmogorovSmirnovTest(double[]&nbsp;x,
                           double[]&nbsp;y)</pre>
<div class="block">Computes the <i>p-value</i>, or <i>observed significance level</i>, of a two-sample <a
 href="http://en.wikipedia.org/wiki/Kolmogorov-Smirnov_test"> Kolmogorov-Smirnov test</a>
 evaluating the null hypothesis that <code>x</code> and <code>y</code> are samples drawn from the same
 probability distribution. Assumes the strict form of the inequality used to compute the
 p-value. See <a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#kolmogorovSmirnovTest(org.apache.commons.math3.distribution.RealDistribution,%20double[],%20boolean)"><code>kolmogorovSmirnovTest(RealDistribution, double[], boolean)</code></a>.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>x</code> - first sample dataset</dd><dd><code>y</code> - second sample dataset</dd>
<dt><span class="strong">Returns:</span></dt><dd>p-value associated with the null hypothesis that <code>x</code> and <code>y</code> represent
         samples from the same distribution</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/InsufficientDataException.html" title="class in org.apache.commons.math3.exception">InsufficientDataException</a></code> - if either <code>x</code> or <code>y</code> does not have length at
         least 2</dd>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</a></code> - if either <code>x</code> or <code>y</code> is null</dd></dl>
</li>
</ul>
<a name="kolmogorovSmirnovStatistic(double[], double[])">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>kolmogorovSmirnovStatistic</h4>
<pre>public&nbsp;double&nbsp;kolmogorovSmirnovStatistic(double[]&nbsp;x,
                                double[]&nbsp;y)</pre>
<div class="block">Computes the two-sample Kolmogorov-Smirnov test statistic, \(D_{n,m}=\sup_x |F_n(x)-F_m(x)|\)
 where \(n\) is the length of <code>x</code>, \(m\) is the length of <code>y</code>, \(F_n\) is the
 empirical distribution that puts mass \(1/n\) at each of the values in <code>x</code> and \(F_m\)
 is the empirical distribution of the <code>y</code> values.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>x</code> - first sample</dd><dd><code>y</code> - second sample</dd>
<dt><span class="strong">Returns:</span></dt><dd>test statistic \(D_{n,m}\) used to evaluate the null hypothesis that <code>x</code> and
         <code>y</code> represent samples from the same underlying distribution</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/InsufficientDataException.html" title="class in org.apache.commons.math3.exception">InsufficientDataException</a></code> - if either <code>x</code> or <code>y</code> does not have length at
         least 2</dd>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</a></code> - if either <code>x</code> or <code>y</code> is null</dd></dl>
</li>
</ul>
<a name="kolmogorovSmirnovTest(org.apache.commons.math3.distribution.RealDistribution, double[])">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>kolmogorovSmirnovTest</h4>
<pre>public&nbsp;double&nbsp;kolmogorovSmirnovTest(<a href="../../../../../../org/apache/commons/math3/distribution/RealDistribution.html" title="interface in org.apache.commons.math3.distribution">RealDistribution</a>&nbsp;distribution,
                           double[]&nbsp;data)</pre>
<div class="block">Computes the <i>p-value</i>, or <i>observed significance level</i>, of a one-sample <a
 href="http://en.wikipedia.org/wiki/Kolmogorov-Smirnov_test"> Kolmogorov-Smirnov test</a>
 evaluating the null hypothesis that <code>data</code> conforms to <code>distribution</code>.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>distribution</code> - reference distribution</dd><dd><code>data</code> - sample being being evaluated</dd>
<dt><span class="strong">Returns:</span></dt><dd>the p-value associated with the null hypothesis that <code>data</code> is a sample from
         <code>distribution</code></dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/InsufficientDataException.html" title="class in org.apache.commons.math3.exception">InsufficientDataException</a></code> - if <code>data</code> does not have length at least 2</dd>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</a></code> - if <code>data</code> is null</dd></dl>
</li>
</ul>
<a name="kolmogorovSmirnovTest(org.apache.commons.math3.distribution.RealDistribution, double[], double)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>kolmogorovSmirnovTest</h4>
<pre>public&nbsp;boolean&nbsp;kolmogorovSmirnovTest(<a href="../../../../../../org/apache/commons/math3/distribution/RealDistribution.html" title="interface in org.apache.commons.math3.distribution">RealDistribution</a>&nbsp;distribution,
                            double[]&nbsp;data,
                            double&nbsp;alpha)</pre>
<div class="block">Performs a <a href="http://en.wikipedia.org/wiki/Kolmogorov-Smirnov_test"> Kolmogorov-Smirnov
 test</a> evaluating the null hypothesis that <code>data</code> conforms to <code>distribution</code>.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>distribution</code> - reference distribution</dd><dd><code>data</code> - sample being being evaluated</dd><dd><code>alpha</code> - significance level of the test</dd>
<dt><span class="strong">Returns:</span></dt><dd>true iff the null hypothesis that <code>data</code> is a sample from <code>distribution</code>
         can be rejected with confidence 1 - <code>alpha</code></dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/InsufficientDataException.html" title="class in org.apache.commons.math3.exception">InsufficientDataException</a></code> - if <code>data</code> does not have length at least 2</dd>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</a></code> - if <code>data</code> is null</dd></dl>
</li>
</ul>
<a name="bootstrap(double[], double[], int, boolean)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>bootstrap</h4>
<pre>public&nbsp;double&nbsp;bootstrap(double[]&nbsp;x,
               double[]&nbsp;y,
               int&nbsp;iterations,
               boolean&nbsp;strict)</pre>
<div class="block">Estimates the <i>p-value</i> of a two-sample
 <a href="http://en.wikipedia.org/wiki/Kolmogorov-Smirnov_test"> Kolmogorov-Smirnov test</a>
 evaluating the null hypothesis that <code>x</code> and <code>y</code> are samples drawn from the same
 probability distribution. This method estimates the p-value by repeatedly sampling sets of size
 <code>x.length</code> and <code>y.length</code> from the empirical distribution of the combined sample.
 When <code>strict</code> is true, this is equivalent to the algorithm implemented in the R function
 <code>ks.boot</code>, described in <pre>
 Jasjeet S. Sekhon. 2011. 'Multivariate and Propensity Score Matching
 Software with Automated Balance Optimization: The Matching package for R.'
 Journal of Statistical Software, 42(7): 1-52.
 </pre></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>x</code> - first sample</dd><dd><code>y</code> - second sample</dd><dd><code>iterations</code> - number of bootstrap resampling iterations</dd><dd><code>strict</code> - whether or not the null hypothesis is expressed as a strict inequality</dd>
<dt><span class="strong">Returns:</span></dt><dd>estimated p-value</dd></dl>
</li>
</ul>
<a name="bootstrap(double[], double[], int)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>bootstrap</h4>
<pre>public&nbsp;double&nbsp;bootstrap(double[]&nbsp;x,
               double[]&nbsp;y,
               int&nbsp;iterations)</pre>
<div class="block">Computes <code>bootstrap(x, y, iterations, true)</code>.
 This is equivalent to ks.boot(x,y, nboots=iterations) using the R Matching
 package function. See #bootstrap(double[], double[], int, boolean).</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>x</code> - first sample</dd><dd><code>y</code> - second sample</dd><dd><code>iterations</code> - number of bootstrap resampling iterations</dd>
<dt><span class="strong">Returns:</span></dt><dd>estimated p-value</dd></dl>
</li>
</ul>
<a name="cdf(double, int)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>cdf</h4>
<pre>public&nbsp;double&nbsp;cdf(double&nbsp;d,
         int&nbsp;n)
           throws <a href="../../../../../../org/apache/commons/math3/exception/MathArithmeticException.html" title="class in org.apache.commons.math3.exception">MathArithmeticException</a></pre>
<div class="block">Calculates \(P(D_n < d)\) using the method described in [1] with quick decisions for extreme
 values given in [2] (see above). The result is not exact as with
 <a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#cdfExact(double,%20int)"><code>cdfExact(double, int)</code></a> because calculations are based on
 <code>double</code> rather than <a href="../../../../../../org/apache/commons/math3/fraction/BigFraction.html" title="class in org.apache.commons.math3.fraction"><code>BigFraction</code></a>.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>d</code> - statistic</dd><dd><code>n</code> - sample size</dd>
<dt><span class="strong">Returns:</span></dt><dd>\(P(D_n < d)\)</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/MathArithmeticException.html" title="class in org.apache.commons.math3.exception">MathArithmeticException</a></code> - if algorithm fails to convert <code>h</code> to a
         <a href="../../../../../../org/apache/commons/math3/fraction/BigFraction.html" title="class in org.apache.commons.math3.fraction"><code>BigFraction</code></a> in expressing <code>d</code> as \((k
         - h) / m\) for integer <code>k, m</code> and \(0 \le h < 1\)</dd></dl>
</li>
</ul>
<a name="cdfExact(double, int)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>cdfExact</h4>
<pre>public&nbsp;double&nbsp;cdfExact(double&nbsp;d,
              int&nbsp;n)
                throws <a href="../../../../../../org/apache/commons/math3/exception/MathArithmeticException.html" title="class in org.apache.commons.math3.exception">MathArithmeticException</a></pre>
<div class="block">Calculates <code>P(D_n &lt; d)</code>. The result is exact in the sense that BigFraction/BigReal is
 used everywhere at the expense of very slow execution time. Almost never choose this in real
 applications unless you are very sure; this is almost solely for verification purposes.
 Normally, you would choose <a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#cdf(double,%20int)"><code>cdf(double, int)</code></a>. See the class
 javadoc for definitions and algorithm description.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>d</code> - statistic</dd><dd><code>n</code> - sample size</dd>
<dt><span class="strong">Returns:</span></dt><dd>\(P(D_n < d)\)</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/MathArithmeticException.html" title="class in org.apache.commons.math3.exception">MathArithmeticException</a></code> - if the algorithm fails to convert <code>h</code> to a
         <a href="../../../../../../org/apache/commons/math3/fraction/BigFraction.html" title="class in org.apache.commons.math3.fraction"><code>BigFraction</code></a> in expressing <code>d</code> as \((k
         - h) / m\) for integer <code>k, m</code> and \(0 \le h < 1\)</dd></dl>
</li>
</ul>
<a name="cdf(double, int, boolean)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>cdf</h4>
<pre>public&nbsp;double&nbsp;cdf(double&nbsp;d,
         int&nbsp;n,
         boolean&nbsp;exact)
           throws <a href="../../../../../../org/apache/commons/math3/exception/MathArithmeticException.html" title="class in org.apache.commons.math3.exception">MathArithmeticException</a></pre>
<div class="block">Calculates <code>P(D_n &lt; d)</code> using method described in [1] with quick decisions for extreme
 values given in [2] (see above).</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>d</code> - statistic</dd><dd><code>n</code> - sample size</dd><dd><code>exact</code> - whether the probability should be calculated exact using
        <a href="../../../../../../org/apache/commons/math3/fraction/BigFraction.html" title="class in org.apache.commons.math3.fraction"><code>BigFraction</code></a> everywhere at the expense of
        very slow execution time, or if <code>double</code> should be used convenient places to
        gain speed. Almost never choose <code>true</code> in real applications unless you are very
        sure; <code>true</code> is almost solely for verification purposes.</dd>
<dt><span class="strong">Returns:</span></dt><dd>\(P(D_n < d)\)</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/MathArithmeticException.html" title="class in org.apache.commons.math3.exception">MathArithmeticException</a></code> - if algorithm fails to convert <code>h</code> to a
         <a href="../../../../../../org/apache/commons/math3/fraction/BigFraction.html" title="class in org.apache.commons.math3.fraction"><code>BigFraction</code></a> in expressing <code>d</code> as \((k
         - h) / m\) for integer <code>k, m</code> and \(0 \le h < 1\).</dd></dl>
</li>
</ul>
<a name="pelzGood(double, int)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>pelzGood</h4>
<pre>public&nbsp;double&nbsp;pelzGood(double&nbsp;d,
              int&nbsp;n)</pre>
<div class="block">Computes the Pelz-Good approximation for \(P(D_n < d)\) as described in [2] in the class javadoc.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>d</code> - value of d-statistic (x in [2])</dd><dd><code>n</code> - sample size</dd>
<dt><span class="strong">Returns:</span></dt><dd>\(P(D_n < d)\)</dd><dt><span class="strong">Since:</span></dt>
  <dd>3.4</dd></dl>
</li>
</ul>
<a name="ksSum(double, double, int)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>ksSum</h4>
<pre>public&nbsp;double&nbsp;ksSum(double&nbsp;t,
           double&nbsp;tolerance,
           int&nbsp;maxIterations)</pre>
<div class="block">Computes \( 1 + 2 \sum_{i=1}^\infty (-1)^i e^{-2 i^2 t^2} \) stopping when successive partial
 sums are within <code>tolerance</code> of one another, or when <code>maxIterations</code> partial sums
 have been computed. If the sum does not converge before <code>maxIterations</code> iterations a
 <a href="../../../../../../org/apache/commons/math3/exception/TooManyIterationsException.html" title="class in org.apache.commons.math3.exception"><code>TooManyIterationsException</code></a> is thrown.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>t</code> - argument</dd><dd><code>tolerance</code> - Cauchy criterion for partial sums</dd><dd><code>maxIterations</code> - maximum number of partial sums to compute</dd>
<dt><span class="strong">Returns:</span></dt><dd>Kolmogorov sum evaluated at t</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/TooManyIterationsException.html" title="class in org.apache.commons.math3.exception">TooManyIterationsException</a></code> - if the series does not converge</dd></dl>
</li>
</ul>
<a name="exactP(double, int, int, boolean)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>exactP</h4>
<pre>public&nbsp;double&nbsp;exactP(double&nbsp;d,
            int&nbsp;n,
            int&nbsp;m,
            boolean&nbsp;strict)</pre>
<div class="block">Computes \(P(D_{n,m} > d)\) if <code>strict</code> is <code>true</code>; otherwise \(P(D_{n,m} \ge
 d)\), where \(D_{n,m}\) is the 2-sample Kolmogorov-Smirnov statistic. See
 <a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#kolmogorovSmirnovStatistic(double[],%20double[])"><code>kolmogorovSmirnovStatistic(double[], double[])</code></a> for the definition of \(D_{n,m}\).
 <p>
 The returned probability is exact, implemented by unwinding the recursive function
 definitions presented in [4] (class javadoc).
 </p></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>d</code> - D-statistic value</dd><dd><code>n</code> - first sample size</dd><dd><code>m</code> - second sample size</dd><dd><code>strict</code> - whether or not the probability to compute is expressed as a strict inequality</dd>
<dt><span class="strong">Returns:</span></dt><dd>probability that a randomly selected m-n partition of m + n generates \(D_{n,m}\)
         greater than (resp. greater than or equal to) <code>d</code></dd></dl>
</li>
</ul>
<a name="approximateP(double, int, int)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>approximateP</h4>
<pre>public&nbsp;double&nbsp;approximateP(double&nbsp;d,
                  int&nbsp;n,
                  int&nbsp;m)</pre>
<div class="block">Uses the Kolmogorov-Smirnov distribution to approximate \(P(D_{n,m} > d)\) where \(D_{n,m}\)
 is the 2-sample Kolmogorov-Smirnov statistic. See
 <a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#kolmogorovSmirnovStatistic(double[],%20double[])"><code>kolmogorovSmirnovStatistic(double[], double[])</code></a> for the definition of \(D_{n,m}\).
 <p>
 Specifically, what is returned is \(1 - k(d \sqrt{mn / (m + n)})\) where \(k(t) = 1 + 2
 \sum_{i=1}^\infty (-1)^i e^{-2 i^2 t^2}\). See <a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#ksSum(double,%20double,%20int)"><code>ksSum(double, double, int)</code></a> for
 details on how convergence of the sum is determined. This implementation passes <code>ksSum</code>
 <a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#KS_SUM_CAUCHY_CRITERION">1.0E-20</a> as <code>tolerance</code> and
 <a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#MAXIMUM_PARTIAL_SUM_COUNT">100000</a> as <code>maxIterations</code>.
 </p></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>d</code> - D-statistic value</dd><dd><code>n</code> - first sample size</dd><dd><code>m</code> - second sample size</dd>
<dt><span class="strong">Returns:</span></dt><dd>approximate probability that a randomly selected m-n partition of m + n generates
         \(D_{n,m}\) greater than <code>d</code></dd></dl>
</li>
</ul>
<a name="monteCarloP(double, int, int, boolean, int)">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>monteCarloP</h4>
<pre>public&nbsp;double&nbsp;monteCarloP(double&nbsp;d,
                 int&nbsp;n,
                 int&nbsp;m,
                 boolean&nbsp;strict,
                 int&nbsp;iterations)</pre>
<div class="block">Uses Monte Carlo simulation to approximate \(P(D_{n,m} > d)\) where \(D_{n,m}\) is the
 2-sample Kolmogorov-Smirnov statistic. See
 <a href="../../../../../../org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html#kolmogorovSmirnovStatistic(double[],%20double[])"><code>kolmogorovSmirnovStatistic(double[], double[])</code></a> for the definition of \(D_{n,m}\).
 <p>
 The simulation generates <code>iterations</code> random partitions of <code>m + n</code> into an
 <code>n</code> set and an <code>m</code> set, computing \(D_{n,m}\) for each partition and returning
 the proportion of values that are greater than <code>d</code>, or greater than or equal to
 <code>d</code> if <code>strict</code> is <code>false</code>.
 </p></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>d</code> - D-statistic value</dd><dd><code>n</code> - first sample size</dd><dd><code>m</code> - second sample size</dd><dd><code>iterations</code> - number of random partitions to generate</dd><dd><code>strict</code> - whether or not the probability to compute is expressed as a strict inequality</dd>
<dt><span class="strong">Returns:</span></dt><dd>proportion of randomly generated m-n partitions of m + n that result in \(D_{n,m}\)
         greater than (resp. greater than or equal to) <code>d</code></dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!--   -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/KolmogorovSmirnovTest.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><em><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script></em></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../org/apache/commons/math3/stat/inference/GTest.html" title="class in org.apache.commons.math3.stat.inference"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../../org/apache/commons/math3/stat/inference/MannWhitneyUTest.html" title="class in org.apache.commons.math3.stat.inference"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html" target="_top">Frames</a></li>
<li><a href="KolmogorovSmirnovTest.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_bottom");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field_summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field_detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!--   -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2003&#x2013;2016 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>
